This directory has an example loadable kernel server and a user-level program that communicates with it.  

The loadable kernel server accepts two MiG-generated remote procedure calls:  mydriver_import(), which sends data to the server, and mydriver_export(), which gets data from the server.

Chapter 3, "Using Loadable Kernel Servers," of NeXT Operating System Software gives more information on implementing user-level programs that communicate with loadable kernel servers.  Writing Loadable Kernel Servers gives information on implementing your own loadable kernel server.

To build the loadable kernel server and user program, follow these steps:

1)  Make a copy of this directory and change to the new directory in a Terminal window.  For example:
	localhost> cp -r /NextDeveloper/Examples/UNIX/LKSOutOfLineData ~
	localhost> cd ~/LKSOutOfLineData

2)  Run make in the KernelServer directory.  (It's important that you make the server before the user program, since the user program depends on files created during this step.)
	localhost> cd KernelServer
	localhost> make
	
3)  Run make in the User directory.  
	localhost> cd ../User
	localhost> make

To use the user program:

1)  Allocate the loadable kernel server.  It loads automatically once it's allocated.
	localhost> su
	Password:
	localhost# kl_util -a ../KernelServer/mydriver_reloc
	Adding server with relocatable /me/LKSOutOfLineData/User/.. 			/KernelServer/mydriver_reloc
	Allocating server mydriver
	Server mydriver linking /me/LKSOutOfLineData/User/..
		/KernelServer/mydriver_reloc against /mach
	Server mydriver linking relocatable "/me/LKSOutOfLineData/User/..
		/KernelServer/mydriver_reloc" into loadable "/me/
		LKSOutOfLineData/User/../KernelServer/mydriver_loadable"
	Server mydriver Allocated
	localhost# 

2)  Run the user program.  
	localhost# ./test
	Data is: blah
	Calling mydriver_import().
	Calling mydriver_export().
	Trying to access data.
	First data element is: A
	Second data element is: C
	Third data element is: K
	Fourth data element is: 
	Fifth data element is: 
	Contents of data are: ACK
	
3)  If you wish to modify the loadable kernel server and then reload it, you should delete the running version of the kern_loader before allocating the kernel server again.
	localhost# kl_util -d mydriver
	Server mydriver deallocating
	Server mydriver unloading
	Server mydriver re-Allocated
	Server mydriver Deallocated